package com.example.spring;

import com.example.spring.bean.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ClassName:testStudent
 * Package:com.example.spring
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/5/8-21:58
 * @Version:v1.0
 */
public class testStudent {

    @Test
    public void PersonFactory() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-date.xml");
        Student student2 = applicationContext.getBean("student2", Student.class);
        System.out.println(student2);
    }

    @Test
    public void student() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-date.xml");
        Student student = applicationContext.getBean("student", Student.class);
        System.out.println(student);

        Student stu = applicationContext.getBean("stu", Student.class);
        System.out.println(stu);
    }
}
